package com.hxalex.simulationhandle.ui.home.model;

import com.hxalex.simulationhandle.common.BaseModel;
import com.hxalex.simulationhandle.db.DaoSession;
import com.hxalex.simulationhandle.db.TaskBeanDao;

import org.greenrobot.greendao.DaoException;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Keep;
import org.greenrobot.greendao.annotation.ToMany;

import java.io.Serializable;
import java.util.List;
import com.hxalex.simulationhandle.db.WebSiteBeanDao;
import com.hxalex.simulationhandle.db.KeyWordBeanDao;

/**
 * Created by hx_Alex on 2018/5/22.
 */
@Entity
public class TaskBean extends BaseModel implements Serializable {
    private static final long serialVersionUID = 2552429215424205489L;
    @Id(autoincrement = true)
    private Long taskId;
    private String taskTitle;
    private String taskState;
    private int taskKeyWord;
    private int taskWebSite;
    private int taskStopTime;
    private int taskExecuteNum;
    @ToMany(referencedJoinProperty = "keyWordId")
    private List<KeyWordBean> keyWordBeanList;
    @ToMany(referencedJoinProperty = "webSiteId")
    private List<WebSiteBean> webSiteBeanList;
    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;
    /** Used for active entity operations. */
    @Generated(hash = 281453257)
    private transient TaskBeanDao myDao;

    public TaskBean(String taskTitle, String taskState, int taskKeyWord, int taskWebSite, int taskExecuteNum,int taskStopTime) {
        this.taskTitle = taskTitle;
        this.taskState = taskState;
        this.taskKeyWord = taskKeyWord;
        this.taskWebSite = taskWebSite;
        this.taskExecuteNum = taskExecuteNum;
        this.taskStopTime=taskStopTime;
    }


    @Generated(hash = 1989761235)
    public TaskBean(Long taskId, String taskTitle, String taskState, int taskKeyWord, int taskWebSite,
            int taskStopTime, int taskExecuteNum) {
        this.taskId = taskId;
        this.taskTitle = taskTitle;
        this.taskState = taskState;
        this.taskKeyWord = taskKeyWord;
        this.taskWebSite = taskWebSite;
        this.taskStopTime = taskStopTime;
        this.taskExecuteNum = taskExecuteNum;
    }


    @Generated(hash = 1443476586)
    public TaskBean() {
    }


    public Long getTaskId() {
        return taskId;
    }

    public void setTaskId(Long taskId) {
        this.taskId = taskId;
    }

    public String getTaskTitle() {
        return taskTitle;
    }

    public void setTaskTitle(String taskTitle) {
        this.taskTitle = taskTitle;
    }

    public String getTaskState() {
        return taskState;
    }

    public void setTaskState(String taskState) {
        this.taskState = taskState;
    }

    public int getTaskKeyWord() {
        return taskKeyWord;
    }

    public void setTaskKeyWord(int taskKeyWord) {
        this.taskKeyWord = taskKeyWord;
    }

    public int getTaskWebSite() {
        return taskWebSite;
    }

    public void setTaskWebSite(int taskWebSite) {
        this.taskWebSite = taskWebSite;
    }

    public int getTaskExecuteNum() {
        return taskExecuteNum;
    }

    public void setTaskExecuteNum(int taskExecuteNum) {
        this.taskExecuteNum = taskExecuteNum;
    }
    @Keep
    public List<KeyWordBean> getKeyWordBeanList() {
        return keyWordBeanList;
    }
    @Keep
    public void setKeyWordBeanList(List<KeyWordBean> keyWordBeanList) {
        this.keyWordBeanList = keyWordBeanList;
    }
    @Keep
    public List<WebSiteBean> getWebSiteBeanList() {
        return webSiteBeanList;
    }
    @Keep
    public void setWebSiteBeanList(List<WebSiteBean> webSiteBeanList) {
        this.webSiteBeanList = webSiteBeanList;
    }


    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    @Generated(hash = 560101165)
    public synchronized void resetKeyWordBeanList() {
        keyWordBeanList = null;
    }


    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    @Generated(hash = 1464068140)
    public synchronized void resetWebSiteBeanList() {
        webSiteBeanList = null;
    }


    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }


    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }


    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }


    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 1769608413)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getTaskBeanDao() : null;
    }


    public int getTaskStopTime() {
        return this.taskStopTime;
    }


    public void setTaskStopTime(int taskStopTime) {
        this.taskStopTime = taskStopTime;
    }
}
